//
//  SEChatPrescriptionCell.swift
//  SmartEyeForDoctor
//
//  Created by QDSG on 2021/5/13.
//

import UIKit

class SEChatPrescriptionCell: UITableViewCell {
    
    override func setHighlighted(_ highlighted: Bool, animated: Bool) {
        super.setHighlighted(highlighted, animated: animated)
        containerView.backgroundColor = highlighted ? Asset.clickHighlight.color : Asset.white.color
    }

    func update(with viewModel: SEChatViewModel) {
        recommendLabel.text = viewModel.chatRecord.prescription?.proposal
        diagnosisLabel.text = viewModel.chatRecord.prescription?.diagnoseName
        drugsLabel.text = viewModel.chatRecord.prescription?.drugName
        priceLabel.text = viewModel.prescriptionPrice
        drugsTitleLabel.isHidden = viewModel.chatRecord.prescription?.status == .noDrug
        priceTitleLabel.isHidden = viewModel.chatRecord.prescription?.status == .noDrug
        drugsLabel.isHidden = viewModel.chatRecord.prescription?.status == .noDrug
        priceLabel.isHidden = viewModel.chatRecord.prescription?.status == .noDrug
    }
    
    @IBOutlet private weak var containerView: UIView! {
        didSet {
            containerView.layer.cornerRadius = 6
            containerView.layer.borderColor = UIColor(hex: "#EBEBEB").cgColor
            containerView.layer.borderWidth = 1
            containerView.layer.masksToBounds = true
        }
    }
    
    @IBOutlet private weak var drugsTitleLabel: UILabel!
    @IBOutlet private weak var priceTitleLabel: UILabel!
    @IBOutlet private weak var recommendLabel: UILabel!
    @IBOutlet private weak var diagnosisLabel: UILabel!
    @IBOutlet private weak var drugsLabel: UILabel!
    @IBOutlet private weak var priceLabel: UILabel!
}
